﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorkRecord
{

    public class MyDate
    {
        public DateTime DateTime
        {
            set
            {
                this.RealYear = value.Year;
                this.RealMonth = value.Month;
                this.Day = value.Day;

                this.ConverYear = this.RealYear;
                this.ConverMonth = this.RealMonth;
                if (this.Day > 25)
                {
                    if (this.RealMonth == 12)
                    {
                        this.ConverYear = this.RealYear + 1;
                        this.ConverMonth = 1;
                    }
                    else
                    {
                        this.ConverMonth = this.RealMonth + 1;
                    }
                }
                else
                {
                    this.ConverYear = this.RealYear;
                    this.ConverMonth = this.RealMonth;

                }

                this.CaculYear = this.RealYear;
                this.CaculMonth = this.RealMonth;
                if (this.Day < 26)
                {
                    if (this.RealMonth == 1)
                    {
                        this.CaculYear = this.RealYear - 1;
                        this.CaculMonth = 12;
                    }
                    else
                    {
                        this.CaculMonth = this.RealMonth - 1;
                    }
                }
            }
        }

        public int RealYear { get; set; }
        public int RealMonth { get; set; }
        public int Day { get; set; }
        public int ConverYear { get; set; }
        public int ConverMonth { get; set; }
        public int CaculYear { get; set; }
        public int CaculMonth { get; set; }

        public DateTime GetRealDate(int year, int month, int day)
        {
            if (day > 25)
            {
                if (month == 1)
                {
                    month = 12;
                    year = year - 1;
                }
                else
                {
                    month = month - 1;
                }

            }

            return new DateTime(year, month, day);
        }
    }
}